﻿using System;
using System.Linq;
using Informant.Clients.DataProviders.Wpf4.InformantService;
using Informant.Clients.Wpf4;
using Informant.SmsMessaging;

namespace Informant.Clients.ViewModels.Wpf4
{
	public class SmsMessagingViewModel : SmsMessagingBaseViewModel
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="SmsMessagingViewModel"/> class.
		/// </summary>
		public SmsMessagingViewModel()
		{
			MessageBody = String.Empty;

			SendSms = new DelegateCommand<Object>(SendSmsHandler, CanSendSms, new[] { "Recipients", "MessageBody" });
			ChangeItemIsSelected = new DelegateCommand<Object>(ChangeItemIsSelectedHandler);
		}

		/// <summary>
		/// Sends an sms.
		/// </summary>
		/// <value>The send SMS.</value>
		public DelegateCommand<Object> SendSms { get; set; }
		/// <summary>
		/// Adds or removes items from the collection of selected items they belong to.
		/// </summary>
		/// <value>The change item is selected.</value>
		public DelegateCommand<Object> ChangeItemIsSelected { get; set; }

		//TODO: REMOVE
		protected override ISms GenerateSms()
		{
			return new Sms
			{
				Recipients = Recipients,
				Messages = new[] { new Message { Text = MessageBody } }.ToList()
			};
		}
	
	}
}
